/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package koneksi;

import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;
import java.sql.Connection;

/**
 *
 * @author Dante
 */
public class Koneksi {

    Connection con = null;

    public Connection getConnect() {

        try {
            MysqlDataSource ds = new MysqlDataSource();
            ds.setUser("root");
            ds.setPassword("root");
            ds.setDatabaseName("dbkampus");
            ds.setPort(3306);
            con = ds.getConnection();
        } catch (Exception e) {
            e.printStackTrace();
        }

        return con;
        
    }

//    public static void main(String[] args) {
//        Koneksi k = new Koneksi();
//        try {
//            k.getConnect();
//            System.out.println("sukses");
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//    }
}
